1. Technical Field
This invention relates generally to multi-tasking, and more specifically to a consumer task requiring results from one or more producer tasks in natural order.
2. Background Art
One important feature of a central processor complex (CPC), a computer system comprising one or more processors, is the ability of the CPC to exploit all resources within the complex. For example, an application executing in the CPC may spawn multiple parallel tasks (multi-tasking) in order to achieve concurrent processing of a specific job, thereby reducing the overall processing time required to complete the job.
In a typical multi-tasking scenario, the processing of a job is divided among a plurality of producer tasks, producers. In addition, a consumer task, consumer, is directed to receive the results from the producers and return the results to the requesting application. The consumer may require the results from the producers in either natural or non-natural order.
Natural order requires the producers to return the results of a job to the consumer in the order of producers. Producer order refers to the numerical order in which the producers were assigned their jobs. For example, if the processing of a database query is divided among four (4) producers (P-1, P-2, P-3, and P-4), the producer order is as follows: P-1 is the first producer, P-2 is the second producer, P-3 is the third producer, and P-4 is the fourth producer. Therefore, the consumer must first receive all of resulting data rows from P-1, followed by all of the resulting data rows from P-2, P-3, and P-4 respectively.
In contrast, when a consumer requires non-natural order, the consumer receives the job results from the producers as the results become available. Therefore, referring again to the above example, the consumer does not wait for P-1 to complete its results before retrieving results from the remaining producers. The consumer may retrieve data rows from any of the producers as the data rows become available.
In contemporary CPCs, a problem arises when a job is divided among multiple producers and requires the results from the producers in natural order. The consumer does not prioritize the producers, thereby resulting in the producers vying equally for system resources such that the completion order of the producers is indeterminable. The consumer simply must wait for the first producer to complete its portion of the job before retrieving and processing its results.
Therefore, by requiring results in natural order, the consumer may incur a waiting period during which the consumer is waiting for the first producer to complete its job. This waiting period is extended when a second producer is allocated system resources at a higher level than the first producer. The second producer may complete its portion of the job prior to the first producer. In such a case, system resources (both input/output and processor resources) are taken away from the first producer and unnecessarily allocated to the second producer, thereby resulting in unneeded advanced producing by the second producer.
Therefore, there is a need for a pacing mechanism by which a consumer, requiring results in natural order, can regulate the processing of a plurality of producers. A pacing mechanism minimizes a consumer's waiting period for results and prevents the unneeded advanced producing of the producers by the misallocation of system resources.